package com.biodiv.miracle.aop;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;

/**
 * @Author: tianquan
 * @date: 2024-10-09  11:09
 * @Description: 连接点实现
 */
public class JoinPintImpl implements JoinPoint {

    Object object;

    Method method;

    Object[] args;

    public JoinPintImpl(Object object, Method method, Object[] args) {
        this.args = args;
        this.method = method;
        this.object = object;
    }

    @Override
    public Object proceed() throws Throwable {
        return method.invoke(object, args);
    }

    @Override
    public Object proceed(Object[] args) throws Throwable {
        return method.invoke(object, args);
    }

    @Override
    public Object getTarget() {
        return object;
    }

    @Override
    public Object[] getArgs() {
        return args;
    }

    @Override
    public Annotation[] getAnnotations() {
        return Object.class.getAnnotations();
    }

    @Override
    public Method getMethod() {
        return this.method;
    }


}
